package com.alibaba.wallstreet.uitls;


import java.io.File;




public class LineTemplateCaseUtil {

	/**
	 * @param lineCase     case序号（1-8）
	 * @return             对应模板的下载路径
	 */
    private static String getPath(){
        return File.separator+"resources"+File.separator+"excel"+File.separator;
    }
    
    
	/**
	 * @param lineCase
	 * @return     获取下载模板的文件全名
	 */
	public static String getExcelPath(int lineCase) {
		// TODO Auto-generated method stub
		switch(lineCase){
		case 1:
			return getPath()+"Case1.xlsx";//国内银行账号收款业务录票
		case 2:
			return getPath()+"Case2.xlsx";//国内银行账号收款非业务录票
		case 3:
			return getPath()+"Case3.xlsx";//支付宝收款业务录票
		case 4:
			return getPath()+"Case4.xlsx";//支付宝收款非业务录票
		case 5:
			return getPath()+"Case5.xlsx";//第三方平台收款
		case 6:
			return getPath()+"Case6.xlsx";//第三方平台收款非业务录票
		case 7:
			return getPath()+"Case7.xlsx";//国外银行账号收款业务录票
		default:
			return getPath()+"Case8.xlsx";//国外银行账号收款非业务录票
		}
	}
	
	
	/**
	 * @param lineCase
	 * @return 审批页面的下载模板
	 */
	public static String getExcelAudit(int lineCase) {
        // TODO Auto-generated method stub
        switch(lineCase){
            case 11:
                return getPath()+"ForeignBanksDownloadFpmLine.xlsx";//国外银行
            case 12:
                return getPath()+"ThirdPartyPlatformDownloadFpmLine.xlsx";//国外银行
            case 13:
                return getPath()+"DomesticBanksDownloadFpmLine.xlsx";//国内银行导出
            default:
                return getPath()+"AlipayDownloadFpmLine.xlsx";//国内银行导出
            }
    }
	
	/**
	 * @param lineCase
	 * @return 获取导出结算行Excel模板的文件全名
	 */
	public static String getLineExcelPath(int lineCase) {
        // TODO Auto-generated method stub
        switch(lineCase){
        case 1:
            return getPath()+"Case1DownLoadFpmLinev1.0.xlsx";//新增结算单页面导出明细行
        case 2:
            return getPath()+"Case2DownLoadFpmLinev1.0.xlsx";
        case 3:
            return getPath()+"Case3DownLoadFpmLinev1.0.xlsx";
        case 4:
            return getPath()+"Case4DownLoadFpmLinev1.0.xlsx";
        case 5:
            return getPath()+"Case5DownLoadFpmLinev1.0.xlsx";
        case 6:
            return getPath()+"Case6DownLoadFpmLinev1.0.xlsx";
        case 7:
            return getPath()+"Case7DownLoadFpmLinev1.0.xlsx";
        default:
            return getPath()+"Case8DownLoadFpmLinev1.0.xlsx";
        }
    }
	
//	Case1批量修改.xlsx
	public static String getUpdateTemplate(int lineCase){
	    if(lineCase<1||lineCase>8)
	        return null;
	    return getPath()+"BatchModify.xlsx";//批量修改
	}
	
	/**
	 * @param lineCase
	 * @return 获取发票字段在Excel行中的起始位置
	 */
	public static int getInvoiceIndex(int lineCase) {
        // TODO Auto-generated method stub
        switch (lineCase) {
            case 1:
                return 'R' - 'A';
            case 3:
            case 5:
                return 'M' - 'A';
            case 7:
                return 'Z' + 4 - 'A';
            default:return -1;
        }
    }
	
	
	public static int getImportInvoiceIndex(int lineCase) {
        // TODO Auto-generated method stub
        switch (lineCase) {
            case 1:
                return 'P' - 'A'+1;
            case 3:
            case 5:
                return 'H' - 'A'+2;
            case 7:
                return 'Z' + 3 - 'A';
            default:return -1;
        }
    }
	
	public static int getTheEndOfRowIndex(int lineCase){
	    if(lineCase%2!=0){
	        return getImportInvoiceIndex(lineCase)+6;
	    }else{
	        switch (lineCase) {
                case 2:
                    return 'N'-'A'+3;
                case 4:
                case 6:
                    return 'G'-'A'+2;
                case 8:
                    return 'Z'-'A'+3;
                default:
                    return -1;
            }
	    }
	}
	
	public static int getIndexOfLineTaxRate(int lineCase){
	    switch(lineCase){
	        case 1:
	        case 2:
	            return 'L'-'A';
	        case 3:
	        case 4:
	        case 5:
            case 6:
	            return 'G'-'A';
            case 7:
            case 8:
                return 'Y'-'A';
	    }
	    return -1;
	}

}
